import { $getIsMemberPower } from '@/http/apiManager.js'
import appConfig from '@/config/appConfig.js'
// 计算 应该跳转的页面
export function navigateTo (channelUserId) {
    appConfig.channelUserId = channelUserId
    $getIsMemberPower().then((res) => {
        console.log('查询是否开启会员==>', res.bizData);
        if (!res.bizData.memberIsOpen) {
            // 跳转到输入金额 页面； 
            uni.redirectTo({ url: '/pages/payway/index' });
        } else {
            appConfig.memberBaseUrl = res.bizData.memberSiteUrl
            uni.redirectTo({
                url: '/pageMember/payMember/payMember'
            })
        }
    })
}
// 计算主题色
export function calcThemeColor (key = 'color') {
    const colorObj = {
        wechatLite: {
            color: '#35d757',
            bgColor: '#52cc701a',
            imgUrl: '/static/payIcon/wechat.svg'
        },
        alipayLite: {
            color: '#108ee9',
            BgColor: '#3476fe1a',
            imgUrl: '/static/payIcon/zfb.svg'
        },
        wechatH5: {
            color: '#35d757',
            bgColor: '#52cc701a',
            imgUrl: '/static/payIcon/wechat.svg'
        },
        alipayH5: {
            color: '#108ee9',
            bgColor: '#3476fe1a',
            imgUrl: '/static/payIcon/zfb.svg'
        },
        ysfpayH5: {
            color: '#FF4433',
            bgColor: '#ff44331a',
            imgUrl: '/static/payIcon/ysf.svg'
        },
        otherH5: {
            color: '#3D5D99',
            bgColor: '#334e801a',
            imgUrl: '/static/payIcon/UnionPay.svg'
        }
    }
    return colorObj[appConfig.currentPageType][key]
}